package cn.tedu.file;

import java.io.File;

public class TestDg {

    public static void main(String[] args) {
        File source = new File("E:\\dgtest");
        File target = new File("E:\\dgtest1");
        dg(source,target);
    }

    public static void dg(File source, File target){
        File[] files = source.listFiles();
        if(files==null||files.length==0){
            return;
        }
        for (File oldFile : files) {
            if(!oldFile.isFile()){
                String name = oldFile.getName();
               File newFile = new File(target.getPath()+"\\"+name) ;
               newFile.mkdir();
              dg(oldFile,newFile);
            }
        }
        System.out.println("创建成功");
    }

}
